function Controller(model, view) {
  this.view = view;
  this.model = model;
  this.init();
}

Controller.prototype.init = function () {
  let self = this;
  this.view.addAction(function (val) {
    self.add(val);
  });
  this.view.delAction(function (id) {
    self.remove(id);
  });
};

Controller.prototype.showView = function () {
  let arr = this.model.getAll();
  this.view.render(arr);
};

Controller.prototype.add = function (val) {
  let arr = this.model.add(val);
  this.view.render(arr);
};

Controller.prototype.remove = function (id) {
  let arr = this.model.remove(id);
  this.view.render(arr);
};
